package com.divemotor.ventarepuestosinternet.controller;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name = "localizacionController", eager = true)
@SessionScoped
public class LocalizacionController implements Serializable {

	private static final long serialVersionUID = 1L;

	private String localeCode;
	private Locale locale;

	private static Map<String,Object> countries;
	   
	static{
	       countries = new LinkedHashMap<String,Object>();
	       countries.put("English", Locale.ENGLISH);
	       countries.put("Spanish", new Locale("es"));
	    }

	public LocalizacionController () {
		locale = (Locale) countries.get("English");
		//locale = new Locale("es");
		System.out.println("Mo locale :"+locale +" :"+locale.getLanguage() +" default :"+locale.getDefault());
	}

	
	public String getLocaleCode() {
		return localeCode;
	}

	public void setLocaleCode(String localeCode) {
		this.localeCode = localeCode;
	}

	public Locale getLocale() {
		return locale;
	}

	public void setLocale(Locale locale) {
		this.locale = locale;
	}

	public static Map<String, Object> getCountries() {
		return countries;
	}

	public static void setCountries(Map<String, Object> countries) {
		LocalizacionController.countries = countries;
	}
	
}
